#!/usr/bin/env python
#-*- coding:gbk -*-
u'''
@file upenv.py
@brief update system environment
@author hulei
@version 1.0
@date 2012-07-02
@copyright 2012 Feitian Technologies Co., Ltd. All rights reserved.
'''

from ctypes import *

def main():
    HWND_BROADCAST = 0xffff
    WM_SETTINGCHANGE = 0x001A
    lparam = u"Environment"
    print windll.user32.SendMessageTimeoutW(HWND_BROADCAST, WM_SETTINGCHANGE, 0, lparam, 0, 500, 0)

if __name__ == '__main__':
    main()
